package com.bjtu.lms.util.notice.mail;

import java.util.ArrayList;
import java.util.List;

/**
 *邮件通知
 * @author yilee
 */
public class MailOperation {
	
	public static void main(String[] args) {
		List<String> mailList =new ArrayList<String>();
		mailList.add("sexykai@vip.qq.com");
		sendMails("title","content",mailList);
	}

    public static void sendMails(String title, String contents, List<String> mailList) {
        for (int i = 0; i < mailList.size(); i++) {
            MailSenderInfo mailInfo = new MailSenderInfo();
            mailInfo.setMailServerHost("mail.bjtu.edu.cn");
            mailInfo.setMailServerPort("25");
            mailInfo.setValidate(true);
            mailInfo.setUserName("09301021@bjtu.edu.cn");
            mailInfo.setPassword("Cjystc4998");//您的邮箱密码
            mailInfo.setFromAddress("09301021@bjtu.edu.cn");
            mailInfo.setToAddress(mailList.get(i).toString());
            mailInfo.setSubject(title);
            mailInfo.setContent(contents);
            //这个类主要来发送邮件　　
            SimpleMailSender sms = new SimpleMailSender();
            sms.sendTextMail(mailInfo);//发送文体格式
        }
    }
}
